package com.sj.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * <p>
 * 字典详情表
 * </p>
 *
 * @author 孙峻
 * @since 2022-03-09
 */
@Getter
@Setter
@Accessors(chain = true)
@TableName("dict_detail")
@ApiModel(value = "DictDetail对象", description = "字典详情表")
public class DictDetail implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("字典详情id 自增长")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty("详情名")
    private String label;

    @ApiModelProperty("详情值")
    private String value;

    @ApiModelProperty("字典id")
    private Integer dictId;

    @ApiModelProperty("字典排序")
    private Integer sort;

    @ApiModelProperty("是否删除 1 删除 0 未删除")
    @TableLogic
    private Boolean del;

    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime createTime;

    @ApiModelProperty("更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime updateTime;

    public static DictDetailBuilder builder() {
        return new DictDetailBuilder();
    }


    public static final class DictDetailBuilder {
        private Integer id;
        private String label;
        private String value;
        private Integer dictId;
        private Integer sort;
        private Boolean del;
        private LocalDateTime createTime;
        private LocalDateTime updateTime;

        private DictDetailBuilder() {
        }

        public DictDetailBuilder id(Integer id) {
            this.id = id;
            return this;
        }

        public DictDetailBuilder label(String label) {
            this.label = label;
            return this;
        }

        public DictDetailBuilder value(String value) {
            this.value = value;
            return this;
        }

        public DictDetailBuilder dictId(Integer dictId) {
            this.dictId = dictId;
            return this;
        }

        public DictDetailBuilder sort(Integer sort) {
            this.sort = sort;
            return this;
        }

        public DictDetailBuilder del(Boolean del) {
            this.del = del;
            return this;
        }

        public DictDetailBuilder createTime(LocalDateTime createTime) {
            this.createTime = createTime;
            return this;
        }

        public DictDetailBuilder updateTime(LocalDateTime updateTime) {
            this.updateTime = updateTime;
            return this;
        }

        public DictDetail build() {
            DictDetail dictDetail = new DictDetail();
            dictDetail.setId(id);
            dictDetail.setLabel(label);
            dictDetail.setValue(value);
            dictDetail.setDictId(dictId);
            dictDetail.setSort(sort);
            dictDetail.setDel(del);
            dictDetail.setCreateTime(createTime);
            dictDetail.setUpdateTime(updateTime);
            return dictDetail;
        }
    }
}
